<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="app">
        <comp-a></comp-a>
        <comp-b></comp-b>
        <!-- <comp-c></comp-c> -->
        <comp-d></comp-d>
    </div>
    <hr>
    <div id="root">
        <comp-d></comp-d>
    </div>
</body>
<script>
    var compA=Vue.extend({
        template:`<h2>{{msg}}</h2>`,
        data(){
            return{
                msg:"没种的人是你啊王八蛋"
            }
        }
    });
    Vue.component("compD",{
        template:`<h2>{{msg}}</h2>`,
        data(){
            return{
                msg:"你在教我做事啊"
            }
        }
    })
    new Vue({
        el:"#app",
        components:{
            compA:compA,
            compB:{
                template:`<h2>{{msg}}<comp-c></comp-c></h2>`,
                data(){
                    return{
                        msg:"在这种场面想唬我，你行吗，你当年也不行啊"
                    }
                },
                components:{
                    compC:{
                        template:`<h3>{{msg}}</h3>`,
                        data(){
                            return{
                                msg:"所谓富贵险中求"
                            }
                        }
                    }
                }
            }
        }
    })
    new Vue({
        el:"#root"
    })
</script>
</html>